// index.js
// 获取应用实例
const db = wx.cloud.database()
import musicList from '../../utils/data'


Page({
  data: {
    list: []
  },
  
  onLoad() {
    // console.log(musicList)
    // this.setData({
    //   list:musicList
    // })
    this.getMusicList()
  },
  // 获取云数据库中全部音乐列表
  async getMusicList(){
    let musicList = await db.collection('music').get()
    this.setData({
      list:musicList.data
    })
  },

  // 跳转
  go(e){
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/play/play?id=${id}`,
    })
  }
})
